package com.qf.springcloud.controller;

import com.qf.springcloud.stream.ProducerStream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SenderController {

    @Autowired
    private ProducerStream producerStream;

    @GetMapping("/send")
    public String send(){
        // 声名消息
        Message<String> message = MessageBuilder.withPayload("Hello Steam!!!").build();
        // 发送消息
        producerStream.output().send(message);
        return "message send success!!";
    }


}
